<scritp>
    function getVenueDetails(getvanuename) {
        var venueIndex = $("#" + getvanuename).val();
        var classId = $("#classreview_id").val();
        $.post("<?php echo Yii::app()->createUrl("classVenue/SelectedVenue"); ?>", {venueId: venueIndex, user_id: 2}, function(result) {
            if (result != "") {
                $('#myloader').css('display', 'none');
            }
            $("#showVenueDataResult").html(result);
        });
        $.post("<?php echo Yii::app()->createUrl("ClassBatch/SelectBatchDate"); ?>", {venueId: venueIndex, classes_id: classId}, function(result) {
            
            /* Default Selected Value*/
            var btchIdForTime = result.split("@@");
            btchIdTime = btchIdForTime[1].split("#");
            $("#batchId").val(btchIdTime[0]);
            $("#bookDateId").val(btchIdForTime[2]);
            $.post("<?php echo Yii::app()->createUrl("ClassBatch/SelectBatchTime"); ?>", {id: btchIdTime[0]}, function(result) {
                $("#bookTiming").val(1);
                $("#batchtimeval").html('<select id="getbatchtime"></select>');
                $('#getbatchtime').find('option').remove().end().append(result).val();
                $("#getbatchtime").addClass("batchTime");
                $('.batchTime').fancyfields({});
            });
            $.post("<?php echo Yii::app()->createUrl("ClassBatch/SelectBatchTicket"); ?>", {id: btchIdTime[0]}, function(result) {
                $("#bookSeatId").val(1);
                $("#batchticketval").html('<select id="getbatchseat" class="batchSeat"></select>');
                $('#getbatchseat').find('option').remove().end().append(result).val();
                $("#getbatchseat").addClass("batchSeat");
                $('.batchSeat').fancyfields({
                    onSelectChange: function(input, text, seatval) {
                        $("#bookSeatId").val(seatval);
                        var batchIdVal = $("#batchId").val();
                        $.post("<?php echo Yii::app()->createUrl("ClassBatch/Totalprice"); ?>", {seat: seatval, batchId: batchIdVal}, function(resultprice) {                                       
                            var retultPricedata = resultprice.split("Grand Total Rs. ");
                            $("#totalPrice").html("Total Rs. " + resultprice);
                            $("#totalPriceId").val(retultPricedata[1]);

                        });

                    }
                });
            });
            $.post("<?php echo Yii::app()->createUrl("ClassBatch/Totalprice"); ?>", {seat: 1, batchId: btchIdTime[0]}, function(resultprice) {
                var totalPriceIdVal = resultprice.split("Grand Total Rs. ");
                $("#totalPrice").html(resultprice);
                $("#totalPriceId").val(totalPriceIdVal[1]);
            });
            /* Default Selected Value*/
            $("#batchval").html('<select id="getbatchdate"></select>');
            $('#getbatchdate').find('option').remove().end().append(result).val();
            $("#getbatchdate").addClass("batchDetail");
            $('.batchDetail').fancyfields({
                onSelectChange: function(input, text, val) {
                    if (val != "") {
                        $("#bookDateId").val(text);
                        $("#batchId").val(val);
                        $("#batchTime").val('');
                        $("#bookSeat").val('');
                        $("#totalPrice").html('');
                        $.post("<?php echo Yii::app()->createUrl("ClassBatch/SelectBatchTime"); ?>", {id: val}, function(result) {
                            $("#bookTiming").val('');
                            $("#bookSeatId").val('');
                            $("#batchtimeval").html('<select id="getbatchtime"></select>');
                            $('#getbatchtime').find('option').remove().end().append('<option name="batchTime" value="">Choose Timing</option>' + result).val();
                            $("#batchticketval").html('<select id="getbatchseat" class="batchSeat"></select>');
                            $('#getbatchseat').find('option').remove().end().append('<option name="batchSeat" value="">Choose No. of Tickets</option>');
                            $('.batchSeat').fancyfields({
                                onSelectChange: function(input, text, seatval) {
                                    var batchIdVal = $("#batchId").val();
                                    $.post("<?php echo Yii::app()->createUrl("ClassBatch/Totalprice"); ?>", {seat: seatval, batchId: batchIdVal}, function(resultprice) {
                                        $("#totalPrice").html("Total Rs. " + resultprice);
                                        $("#totalPriceId").val(resultprice);

                                    });


                                }

                            });
                            $("#getbatchtime").addClass("batchTime");
                            $('.batchTime').fancyfields({
                                onSelectChange: function(input, text, dateval) {
                                    if (dateval != "") {
                                        $.post("<?php echo Yii::app()->createUrl("ClassBatch/SelectBatchTicket"); ?>", {id: dateval}, function(result) {
                                            $("#bookTiming").val(1);
                                            $("#batchticketval").html('<select id="getbatchseat" class="batchSeat"></select>');
                                            $('#getbatchseat').find('option').remove().end().append('<option name="batchSeat" value="">Choose No. of Tickets</option>' + result).val();
                                            $("#getbatchseat").addClass("batchSeat");
                                            $('.batchSeat').fancyfields({
                                                onSelectChange: function(input, text, seatval) {
                                                    var batchIdVal = $("#batchId").val();
                                                    $.post("<?php echo Yii::app()->createUrl("ClassBatch/Totalprice"); ?>", {seat: seatval, batchId: batchIdVal}, function(resultprice) {
                                                        var totalPriceIdVal = resultprice.split("Grand Total Rs. ");
                                                        $("#bookSeatId").val(seatval);
                                                        $("#totalPrice").html(resultprice);
                                                        $("#totalPriceId").val(totalPriceIdVal[1]);
                                                    });
                                                }
                                            });
                                        });
                                    } else {
                                        alert("Please choose batch timing!");
                                        $("#bookTiming").val('');
                                        $("#batchticketval").html('<select id="getbatchseat" class="batchSeat"></select>');
                                        $('#getbatchseat').find('option').remove().end().append('<option value="">Choose No. of Tickets</option>').val();
                                        $("#getbatchseat").addClass("batchSeat");
                                        $('.batchSeat').fancyfields({});
                                    }
                                }
                            });

                        });

                    } else {
                        alert("Please select batch date!");
                        $("#batchtimeval").html('<select id="getbatchtime"></select>');
                        $('#getbatchtime').find('option').remove().end().append('<option value="">Choose Timing</option>').val();
                        $("#getbatchtime").addClass("batchTime");
                        $('.batchTime').fancyfields({});

                    }


                }

            });
        });

    }
</scritp>